home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat3x / EventMonAPI.z / EventMonAPI
Encoding:
Text File  |  2002-10-03  |  9.0 KB  |  265 lines

  1.  
  2.  
  3.  
  4. EEEEvvvveeeennnnttttMMMMoooonnnnAAAAPPPPIIII((((3333XXXX))))                                                EEEEvvvveeeennnnttttMMMMoooonnnnAAAAPPPPIIII((((3333XXXX))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      EventMon API - Programmer's Guide
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.       #include <eventmonapi.h>
  13.  
  14.       int EVMONAPI emapiIsDaemonInstalled();
  15.  
  16.       int EVMONAPI emapiIsDaemonStarted();
  17.  
  18.       int EVMONAPI emapiDeclareDaemonUnload();
  19.  
  20.       int EVMONAPI emapiDeclareDaemonReloadConfig();
  21.  
  22.       int EVMONAPI emapiSendEvent(char *hostname_from,unsigned
  23.                 long time,int etype,int epri,char *eventbuffer);
  24.  
  25.  
  26. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  27.      EEEEvvvveeeennnnttttMMMMoooonnnn AAAAPPPPIIII is a set of functions for connecting to and communicating
  28.      with Event Monitor daemon  (see _e_v_e_n_t_m_o_n_d(1M) for more details).
  29.      (EventMon daemon is a system daemon responsible for intercepting all
  30.      system events messages from syslog daemon, filtering and buffering them).
  31.      This API allows different applications to communicate with EventMon
  32.      daemon in order to do the following:
  33.  
  34.      check installed binary image of EventMon daemon in system directory
  35.      (function emapiIsDaemonInstalled());
  36.  
  37.      check if an instance of EventMon daemon is running in system memory
  38.      (function emapiIsDaemonStarted());
  39.  
  40.      declare "unload" event to EventMon daemon (function
  41.      emapiDeclareDaemonUnload());
  42.  
  43.      declare "reload filter configuration" event to EventMon daemon (function
  44.      emapiDeclareDaemonReloadConfig());
  45.  
  46.      send a particular event message to EventMon daemon (function
  47.      emapiSendEvent(...));
  48.  
  49.      This functionalities are provided via set of functions declared in
  50.      eeeevvvveeeennnnttttmmmmoooonnnnaaaappppiiii....hhhh file. All functions are implemented in library
  51.      lllliiiibbbbeeeevvvveeeennnnttttmmmmoooonnnn....ssssoooo.  EventMon API functions use two named pipes, provided by
  52.      EventMon daemon, and internal commands for communication with EventMon
  53.      daemon.  EventMon API quite a small set of error codes in functions.
  54.  
  55.  
  56. iiiinnnntttt EEEEVVVVMMMMOOOONNNNAAAAPPPPIIII eeeemmmmaaaappppiiiiIIIIssssDDDDaaaaeeeemmmmoooonnnnIIIInnnnssssttttaaaalllllllleeeedddd(((())));;;;
  57.      This function allows to check location of a binary file of EventMon
  58.      daemon in system directory.
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. EEEEvvvveeeennnnttttMMMMoooonnnnAAAAPPPPIIII((((3333XXXX))))                                                EEEEvvvveeeennnnttttMMMMoooonnnnAAAAPPPPIIII((((3333XXXX))))
  71.  
  72.  
  73.  
  74.      Parameter(s) - none
  75.      Return value - Non-zero value indicates that executable file of EventMon
  76.      daemon exists in system directory (/usr/etc/eventmond). Zero means that
  77.      EventMon executable doesn't exist in system directory.
  78.  
  79.  
  80. iiiinnnntttt EEEEVVVVMMMMOOOONNNNAAAAPPPPIIII eeeemmmmaaaappppiiiiIIIIssssDDDDaaaaeeeemmmmoooonnnnSSSSttttaaaarrrrtttteeeedddd(((())));;;;
  81.      This function allows to check if an instance of EventMon daemon exists in
  82.      memory.  Application might use this function before using other functions
  83.      from EventMon API.
  84.  
  85.      Parameter(s): none
  86.      Return value: integer. Non-zero value indicates that an instance of
  87.      EventMon daemon is started and exists in memory. Zero means that EventMon
  88.      is not started.
  89.  
  90.  
  91.  
  92. iiiinnnntttt EEEEVVVVMMMMOOOONNNNAAAAPPPPIIII eeeemmmmaaaappppiiiiDDDDeeeeccccllllaaaarrrreeeeDDDDaaaaeeeemmmmoooonnnnUUUUnnnnllllooooaaaadddd(((())));;;;
  93.      This function allows to declare "unload" notification to an instance of
  94.      EventMon daemon. The "declare" term means that after this function call
  95.      EventMon daemon will start unload process.  Due to the fact that this
  96.      process can take up to 2 seconds, EventMon daemon can remain in memory
  97.      immediately after emapiDeclareDaemonUnload call until this "unload"
  98.      process is not completed.
  99.  
  100.      Parameter(s): none
  101.      Return value: integer. Non-zero value indicates a successful passed
  102.      "unload" notification to EventMon daemon.  Zero is returned on error.
  103.      Important notice: application must have "root" permissions/privileges to
  104.      call this function.
  105.  
  106.  
  107. iiiinnnntttt EEEEVVVVMMMMOOOONNNNAAAAPPPPIIII eeeemmmmaaaappppiiiiDDDDeeeeccccllllaaaarrrreeeeDDDDaaaaeeeemmmmoooonnnnRRRReeeellllooooaaaaddddCCCCoooonnnnffffiiiigggg(((())));;;;
  108.      This function allows to declare "reload configuration info" notification
  109.      to an instance of EventMon daemon. This declaration means that after this
  110.      call EventMon daemon will start "reload configuration info" process. This
  111.      process includes three steps:
  112.  
  113.      1. dropping all filter information from internal EventMon memory tables;
  114.      2. connection to system tables which includes filtering information;
  115.      3. adjustment of internal EventMon memory tables according system
  116.      information.
  117.  
  118.      This function call carries the same functionality as following shell
  119.      command:
  120.           "kill -HUP eventmon_pid"
  121.      Parameter(s): none
  122.      Return value: integer. Non-zero value - successful pass of "reload
  123.      configuration info" notification to EventMon daemon. On error the return
  124.      value is zero.
  125.      Important notice: application must have "root" permissions/privileges to
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. EEEEvvvveeeennnnttttMMMMoooonnnnAAAAPPPPIIII((((3333XXXX))))                                                EEEEvvvveeeennnnttttMMMMoooonnnnAAAAPPPPIIII((((3333XXXX))))
  137.  
  138.  
  139.  
  140.      call this function.
  141.  
  142.  
  143. iiiinnnntttt EEEEVVVVMMMMOOOONNNNAAAAPPPPIIII eeeemmmmaaaappppiiiiSSSSeeeennnnddddEEEEvvvveeeennnntttt((((cccchhhhaaaarrrr ****hhhhoooossssttttnnnnaaaammmmeeee____ffffrrrroooommmm,,,,
  144. uuuunnnnssssiiiiggggnnnneeeedddd lllloooonnnngggg ttttiiiimmmmeeee,,,,iiiinnnntttt eeeettttyyyyppppeeee,,,,iiiinnnntttt eeeepppprrrriiii,,,,cccchhhhaaaarrrr ****eeeevvvveeeennnnttttbbbbuuuuffffffffeeeerrrr))));;;;
  145.      This function allows to pass a message with particular sequence number
  146.      and priority/facility code information to EventMon.
  147.  
  148.      Parameter(s):
  149.      char *hostname    - host name from coming event
  150.                          (NULL for localhost)
  151.      unsigned long     - timehost name from coming event
  152.                          (NULL for localhost)
  153.      int etype         - valid event type value (must be non-zero value)
  154.      int epri          - valid priority/facility code (see sys/syslog.h
  155.                          file)
  156.      char *eventbuffer - valid ASCIZ buffer with event message
  157.                          string (must be a valid string pointer
  158.                          and have non zero size)
  159.  
  160.      Return value: integer. Non-zero value indicated successful pass of a
  161.      message to EventMon daemon for processing.  Zero - an error.
  162.  
  163.      Important notice: size of eventbuffer can't be more than
  164.      EVMONAPI_MAXEVENTSIZE (defined in evmonapi.h file) bytes, no more than
  165.      64K bytes.
  166.  
  167.       Sample:
  168.  
  169.       #include <stdio.h>
  170.       #include <sys/syslog.h>
  171.       #include <eventmonapi.h>
  172.  
  173.       main()
  174.       { if(!emapiIsDaemonStarted())
  175.         { printf("EventMon daemon not started!\n");
  176.           exit(0);
  177.         }
  178.         return emapiSendEvent("legalov.sgi.com",0,0x20101C,
  179.                LOG_MAKEPRI(LOG_USER,LOG_INFO), "Hello world!");
  180.       }
  181.  
  182. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  183.      eventmond(1M)
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. EEEEvvvveeeennnnttttMMMMoooonnnnAAAAPPPPIIII((((3333XXXX))))                                                EEEEvvvveeeennnnttttMMMMoooonnnnAAAAPPPPIIII((((3333XXXX))))
  203.  
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.                                                                         PPPPaaaaggggeeee 4444
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.